package com.eqdd.yiqidian.ui.mine.pizhun;

import android.os.Bundle;
import android.view.View;

import com.eqdd.annotation.datasave.DealCodeClass;
import com.eqdd.yiqidian.R;
import com.eqdd.yiqidian.adapter.SectionDividerItemDecoration;
import com.eqdd.yiqidian.base.CodeRule;
import com.eqdd.yiqidian.bean.EnterBean;
import com.eqdd.yiqidian.bean.rebuild.CommonTabBean;
import com.eqdd.yiqidian.bean.rebuild.LayoutMapBean;
import com.eqdd.yiqidian.http.HttpConfig;
import com.eqdd.yiqidian.rxbus2.RxBus;
import com.eqdd.yiqidian.ui.base.BaseEnterActivity;
import com.eqdd.yiqidian.ui.gongneng.renshi.RenshiActivity$$DealCodeInjector;
import com.eqdd.yiqidian.utils.DensityUtil;
import com.eqdd.yiqidian.utils.ToastUtil;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by lvzhihao on 17-5-20.
 */

public class MyPizhunActivity extends BaseEnterActivity {
    private List<CommonTabBean> commonTabBeans = new ArrayList<>();

    private Class[] classes = new Class[]{
            ShowLeaveCheckActivity.class,
            ShowTravelCheckActivity.class,
            ShowOverTimeCheckActivity.class,
            ShowOffCheckActivity.class,
            ShowChangeShiftCheckActivity.class,
            ShowChidaozaotuiActivity.class,
            ShowLoudakaActivity.class,
            ShowCarActivity.class,
            ShowNewsCheckActivity.class,
            ShowNoticeCheckActivity.class,
            ShowContactBookCheckActivity.class,
            ShowLizhiShenpiActivity.class,
            ShowContractCheckActivity.class,
            ShowRenliActivity.class,
            ShowTrainActivity.class
    };

    @DealCodeClass(classes = {ShowLeaveCheckActivity.class})
    public void updateQingjia(int num) {
        updateNum(0);
    }

    @DealCodeClass(classes = {ShowTravelCheckActivity.class})
    public void updateChuchai(int num) {
        updateNum(1);
    }

    @DealCodeClass(classes = {ShowOverTimeCheckActivity.class})
    public void updateJiaban(int num) {
        updateNum(2);
    }

    @DealCodeClass(classes = {ShowOffCheckActivity.class})
    public void updateTiaoxiu(int num) {
        updateNum(3);
    }

    @DealCodeClass(classes = {ShowChangeShiftCheckActivity.class})
    public void updateTiaoban(int num) {
        updateNum(4);
    }

    @DealCodeClass(classes = {ShowChidaozaotuiActivity.class})
    public void updateChidaozaotui(int num) {
        updateNum(5);
    }

    @DealCodeClass(classes = {ShowLoudakaActivity.class})
    public void updateLoudaka(int num) {
        updateNum(6);
    }

    @DealCodeClass(classes = {ShowNewsCheckActivity.class})
    public void updateNews(int num) {
        updateNum(7);
    }

    @DealCodeClass(classes = {ShowNoticeCheckActivity.class})
    public void updateGonggao(int num) {
        updateNum(8);
    }

    @DealCodeClass(classes = {ShowContactBookCheckActivity.class})
    public void updateLianluoshu(int num) {
        updateNum(9);
    }

    @DealCodeClass(classes = {ShowLizhiShenpiActivity.class})
    public void updateLizhi(int num) {
        updateNum(10);
    }

    @DealCodeClass(classes = {ShowContractCheckActivity.class})
    public void updateLaodonghetong(int num) {
        updateNum(11);
    }

    @Override
    public void itemClick(int p) {

        if (commonTabBeans.get(p) != null) {
            Bundle bundle = new Bundle();
            bundle.putSerializable("bean", commonTabBeans.get(p));
            startActivity(classes[p], bundle);
        } else if (classes[p] != null) {
            startActivity(classes[p]);
        } else {
            ToastUtil.showShort("该模块暂未开发");
        }
    }

    @Override
    public void initEnterData() {
        isDealCode = true;
        initTopTitleBar(View.VISIBLE, "我的批准");
        enterBeans.add(new EnterBean("请假").setCode(CodeRule.PIZHUN_QINGJIA));
        enterBeans.add(new EnterBean("出差").setCode(CodeRule.PIZHUN_CHUCHAI));
        enterBeans.add(new EnterBean("加班").setCode(CodeRule.PIZHUN_JIABAN));
        enterBeans.add(new EnterBean("调休").setCode(CodeRule.PIZHUN_TIAOXIU));
        enterBeans.add(new EnterBean("调班").setCode(CodeRule.PIZHUN_TIAOBAN));
        enterBeans.add(new EnterBean("迟到早退").setCode(CodeRule.PIZHUN_CHIDAOZAOTUI));
        enterBeans.add(new EnterBean("漏打卡").setCode(CodeRule.PIZHUN_LOUDAKA));
        enterBeans.add(new EnterBean("用车"));
        enterBeans.add(new EnterBean("通知").setCode(CodeRule.PIZHUN_TONGZHI));
        enterBeans.add(new EnterBean("公告").setCode(CodeRule.PIZHUN_GONGGAO));
        enterBeans.add(new EnterBean("联络书").setCode(CodeRule.PIZHUN_LIANLUOSHU));
        enterBeans.add(new EnterBean("离职审批").setCode(CodeRule.PIZHUN_LIZHI));
        enterBeans.add(new EnterBean("劳动合同").setCode(CodeRule.PIZHUN_LAODONGHETONG));
        enterBeans.add(new EnterBean("人力需求"));
        enterBeans.add(new EnterBean("培训"));
        commonTabBeans.add(null);
        commonTabBeans.add(null);
        commonTabBeans.add(null);
        commonTabBeans.add(null);
        commonTabBeans.add(null);
        commonTabBeans.add(new CommonTabBean("迟到早退列表", 0,
                null)
                .title("待审核", "已审核")
                .setIdName("sickleaveId")
                .setRight(false)
                .setWho(1)
                .setInfoActivity(SickLeaveInfoActivity.class)
                .setLayoutId(R.layout.list_item_28)
                .map(new LayoutMapBean(R.id.tv_left_content, 6),
                        new LayoutMapBean(R.id.tv_right_hint_content, 7))
                .setUrl(HttpConfig.SICK_LEAVE_CHECK_LIST));
        commonTabBeans.add(new CommonTabBean("漏打卡列表", 0,
                null)
                .title("待审核", "已审核")
                .setIdName("missClockId")
                .setRight(false)
                .setWho(1)
                .setInfoActivity(MissClockInfoActivity.class)
                .setLayoutId(R.layout.list_item_28)
                .map(new LayoutMapBean(R.id.tv_left_content, 8),
                        new LayoutMapBean(R.id.tv_right_hint_content, 7))
                .setUrl(HttpConfig.MISS_CLOCK_LEADER_LIST));
        commonTabBeans.add(null);
        commonTabBeans.add(null);
        commonTabBeans.add(null);
        commonTabBeans.add(null);
        commonTabBeans.add(new CommonTabBean("离职审批列表", 0,
                null)
                .title("审批中", "已通过", "未通过")
                .setIdName("quitId")
                .setRight(false)
                .setWho(1)
                .setInfoActivity(MyPiZhunInfoActivity.class)
                .setLayoutId(R.layout.list_item_13)
                .map(new LayoutMapBean(R.id.tv_left_center_content, "getSix"),
                        new LayoutMapBean(R.id.tv_upper_right_content, 1),
                        new LayoutMapBean(R.id.tv_down_right_content, 2))
                .setUrl(HttpConfig.LIZHI_SHENPI_LIST));
        commonTabBeans.add(null);
        commonTabBeans.add(null);
        commonTabBeans.add(null);
        dataBinding.recyclerView.addItemDecoration(
                new SectionDividerItemDecoration(this, 7, 1, 5)
                        .setHeadHeight(DensityUtil.percentW(50))
                        .setLeftPadding(DensityUtil.percentW(30))
                        .setRightPadding(DensityUtil.percentW(30))
                        .setTitle("考勤", "后勤", "组织管理"));
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
    }
}
